﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Backend.JYD.Model.Task;

namespace Backend.JYD.BLL
{
    public class IntentEntryInfoBLL
    {
        //private static readonly IDAL.Task.IIntentEntryInfo idal = Factory.DALFactory.CreateEFDAL<IDAL.Task.IIntentEntryInfo>("IntentEntryInfoDAL");
        private static IDAL.Task.IIntentEntryInfo idal
        {
            get
            {
                return Factory.DALFactory.CreateEFDAL<IDAL.Task.IIntentEntryInfo>("DAL.IntentEntryInfoDAL");
            }
        }

        public Int64 AddIntentEntryInfo(IntentEntryInfo info)
        {
            if (string.IsNullOrWhiteSpace(info.Phone)) return 0;
            return idal.AddIntentEntryInfo(info);
        }

        public bool UpdateIntentEntryInfo(IntentEntryInfo info)
        {
            if (string.IsNullOrWhiteSpace(info.Phone) || info.IntentId <= 0) return false;
            return idal.UpdateIntentEntryInfo(info);
        }

        public List<IntentEntryInfo> GetIntentEntryInfoByEmpId(Int32 empId)
        {
            if (empId <= 0) return null;
            var list = idal.GetIntentEntryInfoByEmpId(empId);
            return list == null ? null : list.ToList();
        }
    }
}
